<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Random\Randomizer class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.srand.html">« srand</a></li>
      <li style="float: right;"><a href="random-randomizer.construct.html">Random\Randomizer::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.random.html">Random</a></li>
    <li>The Random\Randomizer class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.random-randomizer" class="reference">
 <h1 class="title">The Random\Randomizer class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 8 &gt;= 8.2.0)</p>


  <div class="section" id="random-randomizer.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Provides a high-level API to the randomness provided by an <span class="classname"><a href="class.random-engine.html" class="classname">Random\Engine</a></span>.
   </p>
  </div>


  <div class="section" id="random-randomizer.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <strong class="classname">Random\Randomizer</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.random-engine.html" class="type Random\Engine">Random\Engine</a></span>
      <var class="varname"><a href="class.random-randomizer.html#random-randomizer.props.engine">$<var class="varname">engine</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type"><a href="class.random-engine.html" class="type Random\Engine">Random\Engine</a></span><span class="type"></span></span> <code class="parameter">$engine</code><span class="initializer"> = <strong><code>null</code></strong></span></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.getbytes.html" class="methodname">getBytes</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.getint.html" class="methodname">getInt</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$min</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$max</code></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.nextint.html" class="methodname">nextInt</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.pickarraykeys.html" class="methodname">pickArrayKeys</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$array</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$num</code></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.serialize.html" class="methodname">__serialize</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.shufflearray.html" class="methodname">shuffleArray</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$array</code></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.shufflebytes.html" class="methodname">shuffleBytes</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$bytes</code></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="random-randomizer.unserialize.html" class="methodname">__unserialize</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$data</code></span>): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>



  <div class="section" id="random-randomizer.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="random-randomizer.props.engine"><var class="varname">engine</var></dt>

     <dd>

      <p class="para">
       The low-level source of randomness for the <span class="type"><a href="class.random-randomizer.html" class="type Random\Randomizer">Random\Randomizer</a></span>’s methods.
      </p>
     </dd>

    
   </dl>

  </div>



 </div>

 





































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="random-randomizer.construct.html">Random\Randomizer::__construct</a> — Constructs a new Randomizer</li><li><a href="random-randomizer.getbytes.html">Random\Randomizer::getBytes</a> — Get random bytes</li><li><a href="random-randomizer.getint.html">Random\Randomizer::getInt</a> — Get a uniformly selected integer</li><li><a href="random-randomizer.nextint.html">Random\Randomizer::nextInt</a> — Get a positive integer</li><li><a href="random-randomizer.pickarraykeys.html">Random\Randomizer::pickArrayKeys</a> — Select random array keys</li><li><a href="random-randomizer.serialize.html">Random\Randomizer::__serialize</a> — Serializes the Randomizer object</li><li><a href="random-randomizer.shufflearray.html">Random\Randomizer::shuffleArray</a> — Get a permutation of an array</li><li><a href="random-randomizer.shufflebytes.html">Random\Randomizer::shuffleBytes</a> — Get a byte-wise permutation of a string</li><li><a href="random-randomizer.unserialize.html">Random\Randomizer::__unserialize</a> — Deserializes the data parameter into a Randomizer object</li></ul>
</div>
</div></div></body></html>